# Contributor: Peng Huang <shawn.p.huang@gmail.com>
# Contributor: BYVoid <byvoid1@gmail.com>
# Contributor: Peng Wu <alexepico@gmail.com>
# Maintainer: Ziyao <ziyao@disroot.org>
pkgname=ibus-libpinyin
pkgver=1.15.6
pkgrel=0
pkgdesc="Intelligent Pinyin engine based on libpinyin for IBus"
url="https://github.com/libpinyin/ibus-libpinyin"
# armhf: no libpinyin
arch="all !armhf"
license="GPL-3.0-only"
makedepends="
	ibus-dev
	libpinyin-dev
	sqlite-dev
	"
subpackages="$pkgname-lang"
source="https://github.com/libpinyin/ibus-libpinyin/releases/download/$pkgver/ibus-libpinyin-$pkgver.tar.gz"
options="!check" # there are none

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	CXXFLAGS="$CXXFLAGS -flto=auto" \
	./configure \
		--host=$CHOST \
		--build=$CBUILD \
		--prefix=/usr \
		--libexecdir=/usr/lib/ibus
	make
}

package() {
	make install DESTDIR=$pkgdir

	# remove duplicate python bytecode
	find "$pkgdir" -name "*.opt-1.pyc" -delete
}

sha512sums="
80c0043999fff6718098c9462774ddea6dd4785410d28326bab6dcb304a11af73594a806a2b6483ef5ccc42d79d9a2e95f0b4a29e2e08008de997d4a98e7f62b  ibus-libpinyin-1.15.6.tar.gz
"
